package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.OrderitemVipchannel;
import com.ktgj.service.service.IOrderitemVipchannelService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * VIP通道订单明细Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/vipchannel")
public class OrderitemVipchannelController extends BaseController
{
    @Autowired
    private IOrderitemVipchannelService orderitemVipchannelService;

    /**
     * 查询VIP通道订单明细列表
     */
    @PreAuthorize(hasPermi = "service:vipchannel:list")
    @GetMapping("/list")
    public TableDataInfo list(OrderitemVipchannel orderitemVipchannel)
    {
        startPage();
        List<OrderitemVipchannel> list = orderitemVipchannelService.selectOrderitemVipchannelList(orderitemVipchannel);
        return getDataTable(list);
    }

    /**
     * 导出VIP通道订单明细列表
     */
    @PreAuthorize(hasPermi = "service:vipchannel:export")
    @Log(title = "VIP通道订单明细 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderitemVipchannel orderitemVipchannel) throws IOException
    {
        List<OrderitemVipchannel> list = orderitemVipchannelService.selectOrderitemVipchannelList(orderitemVipchannel);
        ExcelUtil<OrderitemVipchannel> util = new ExcelUtil<OrderitemVipchannel>(OrderitemVipchannel.class);
        util.exportExcel(response, list, "VIP通道订单明细 数据");
    }

    /**
     * 获取VIP通道订单明细详细信息
     */
    @PreAuthorize(hasPermi = "service:vipchannel:query")
    @GetMapping(value = "/{orderitemvipchannelId}")
    public AjaxResult getInfo(@PathVariable("orderitemvipchannelId") Long orderitemvipchannelId)
    {
        return AjaxResult.success(orderitemVipchannelService.selectOrderitemVipchannelById(orderitemvipchannelId));
    }

    /**
     * 新增VIP通道订单明细
     */
    @PreAuthorize(hasPermi = "service:vipchannel:add")
    @Log(title = "VIP通道订单明细 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderitemVipchannel orderitemVipchannel)
    {
        return toAjax(orderitemVipchannelService.insertOrderitemVipchannel(orderitemVipchannel));
    }

    /**
     * 修改VIP通道订单明细
     */
    @PreAuthorize(hasPermi = "service:vipchannel:edit")
    @Log(title = "VIP通道订单明细 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderitemVipchannel orderitemVipchannel)
    {
        return toAjax(orderitemVipchannelService.updateOrderitemVipchannel(orderitemVipchannel));
    }

    /**
     * 删除VIP通道订单明细
     */
    @PreAuthorize(hasPermi = "service:vipchannel:remove")
    @Log(title = "VIP通道订单明细 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderitemvipchannelIds}")
    public AjaxResult remove(@PathVariable Long[] orderitemvipchannelIds)
    {
        return toAjax(orderitemVipchannelService.deleteOrderitemVipchannelByIds(orderitemvipchannelIds));
    }
}
